package com.yzkj.cpjxc.business.domain;

import org.apache.ibatis.type.Alias;

import java.util.ArrayList;
import java.util.List;

/**
 * 权限实体类
 */
@Alias("SysAuthority")
public class SysAuthority extends CommonBean<SysAuthority> {

	private static final long serialVersionUID = 6812276441473500709L;

	public SysAuthority() {

	}

	public SysAuthority(String authorityValue) {
		this.authorityValue = authorityValue;
	}

	/**
	 * 权限主键
	 */
	private String authorityId;

	/**
	 * 父级权限编号
	 */
	private String parentId;

	/**
	 * 权限值
	 */
	private String authorityValue;

	/**
	 * 权限名称
	 */
	private String authorityName;

	/**
	 * 权限类型： 1：普通权限 2：菜单 3：报表
	 */
	private String authorityType;

	/**
	 * 状态 ：1：启用 -1：停止
	 */
	private String status;

	/**
	 * 控制的事件
	 */
	private String action;

	/**
	 * 等级
	 */
	private String grade;

	/**
	 * 备注
	 */
	private String remark;

	/**
	 * 层级代码
	 */
	private String levelCode;

	/**
	 * 排序号
	 */
	private String sortNo;

	//======================================关联字段======================================
	/**
	 * 隶属父权限
	 */
	private SysAuthority parentSysAuthority;

	/**
	 * 下属子权限
	 */
	private List<SysAuthority> sysAuthoritys;

	public SysAuthority getParentSysAuthority() {
		return parentSysAuthority;
	}

	public void setParentSysAuthority(SysAuthority parentSysAuthority) {
		this.parentSysAuthority = parentSysAuthority;
	}

	public List<SysAuthority> getSysAuthoritys() {
		return sysAuthoritys;
	}

	public void setSysAuthoritys(List<SysAuthority> sysAuthoritys) {
		this.sysAuthoritys = sysAuthoritys;
	}

	// =================================================关联集合-end==============================================================================

	public String getAuthorityId() {
		return authorityId;
	}

	public void setAuthorityId(String authorityId) {
		this.authorityId = authorityId;
	}

	public String getParentId() {
		return parentId;
	}

	public void setParentId(String parentId) {
		this.parentId = parentId;
	}

	public String getAuthorityValue() {
		return authorityValue;
	}

	public void setAuthorityValue(String authorityValue) {
		this.authorityValue = authorityValue;
	}

	public String getAuthorityName() {
		return authorityName;
	}

	public void setAuthorityName(String authorityName) {
		this.authorityName = authorityName;
	}

	public String getAuthorityType() {
		return authorityType;
	}

	public void setAuthorityType(String authorityType) {
		this.authorityType = authorityType;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public String getAction() {
		return action;
	}

	public void setAction(String action) {
		this.action = action;
	}

	public String getGrade() {
		return grade;
	}

	public void setGrade(String grade) {
		this.grade = grade;
	}

	public String getRemark() {
		return remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

	public String getLevelCode() {
		return levelCode;
	}

	public void setLevelCode(String levelCode) {
		this.levelCode = levelCode;
	}

	public String getSortNo() {
		return sortNo;
	}

	public void setSortNo(String sortNo) {
		this.sortNo = sortNo;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((authorityValue == null) ? 0 : authorityValue.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		SysAuthority other = (SysAuthority) obj;
		if (authorityValue == null) {
			if (other.authorityValue != null)
				return false;
		} else if (!authorityValue.equals(other.authorityValue))
			return false;
		return true;
	}

	@Override
	public String toString() {
		return "SysAuthority [authorityId=" + authorityId + ", parentId=" + parentId + ", authorityValue=" + authorityValue + ", authorityName=" + authorityName
				+ ", authorityType=" + authorityType + ", status=" + status + ", action=" + action + ", grade=" + grade + ", remark=" + remark + ", levelCode=" + levelCode
				+ ", sortNo=" + sortNo + ", parentSysAuthority=" + parentSysAuthority + ", sysAuthoritys=" + sysAuthoritys + "]";
	}

	public static void main(String[] args) {
		SysAuthority sa = new SysAuthority();
		sa.setAuthorityId("123");
		sa.setAuthorityValue("abc1");

		SysAuthority sa2 = new SysAuthority();
		sa2.setAuthorityId("123");
		sa2.setAuthorityValue("abc2");

		SysAuthority sa3 = new SysAuthority();
		sa3.setAuthorityId("124");
		sa3.setAuthorityValue("abc3");

		List<SysAuthority> list = new ArrayList<SysAuthority>();
		list.add(sa);
		list.add(sa2);
		System.out.println(list.contains(sa3));
		System.out.println(sa.equals(sa2));
	}
}
